<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script src="ckeditor/ckeditor.js"></script>
<link href="ckeditor/sample.css" rel="stylesheet">
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="dist/css/bootstrap.min.css">

<!-- 可选的Bootstrap主题文件（一般不用引入） -->
<link rel="stylesheet" href="dist/css/bootstrap-theme.min.css">

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="jQuery/jquery-2.1.1.min.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="dist/js/bootstrap.min.js"></script>
<script type="text/javascript">
	function loadXMLDoc(str) {
		var xmlhttp;
		if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
			xmlhttp = new XMLHttpRequest();
		} else {// code for IE6, IE5
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.open("GET", "User-checkName?user.name=" + str, true);
		xmlhttp.send();
	}

	var editor = null;
	window.onload = function() {
		editor = CKEDITOR.replace('user.notes', {

			on : {
				instanceReady : function(ev) {
					this.dataProcessor.writer.setRules('p', {
						indent : false,
						breakBeforeOpen : false, //<p>之前不加换行
						breakAfterOpen : false, //<p>之后不加换行
						breakBeforeClose : false, //</p>之前不加换行
						breakAfterClose : false
					//</p>之后不加换行7
					});
				}
			}
		});
	};
</script>
</head>
<body>
	<div style="height: 40px;"></div>
	<form action="User-add" method="post" class="form-horizontal"
		role="form">
		<div class="form-group form-group-lg">
			<label class="col-sm-1 control-label" for="name">戶主姓名:</label>
			<div class="col-xs-3">
				<input name="user.name" type="text" class="form-control" id="name"
					onblur="loadXMLDoc(this.value)" placeholder="输入户主姓名"> <span
					class="help-block" id="myDiv"></span>
			</div>
			<!-- 			<div id="myDiv"></div> -->
		</div>
		<div class="form-group form-group-lg">
			<label class="col-sm-1 control-label" for="address">地址:</label>
			<div class="col-sm-3">
				<input name="user.address" class="form-control" id="address"
					type="text" placeholder="输入地址">
			</div>
		</div>
		<div class="form-group form-group-lg">
			<label class="col-sm-1 control-label" for="phone"> 联系电话:</label>
			<div class="col-sm-3">
				<input name="user.phone" id="phone" class="form-control" type="text"
					placeholder="输入联系方式">
			</div>
		</div>
		<div class="form-group form-group-lg">
			<label class="col-sm-1 control-label" for="userType"> 用户类型:</label>
			<div class="col-sm-3">
				<s:select name="user.userType" cssClass="form-control"
					list="@com.zcg.gasmanager.model.TYPE@values()" listKey="name()"
					listValue="toString()" theme="simple" />
			</div>
		</div>
		<div class="form-group form-group-lg">
			<label class="col-sm-1 control-label" for="notes"> 备注</label>
			<div class="col-sm-5">
				<textarea cols="4" id="editor1" name="user.notes" rows="10"
					placeholder="输入备注信息"></textarea>
			</div>
		</div>
		<div class="form-group form-group-lg">
			<label for="exampleInputPassword1" class="col-sm-1 control-label">操作:</label>
			<div class="form-group form-group-lg">
				<div class="col-sm-4">
					<button type="submit" class="btn btn-success btn-lg"
						onclick="save()">添加</button>
				</div>
			</div>
		</div>
	</form>
</body>
</html>